<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="box"></div>
    <script>
        // ES6 proxy
        const obj = {}

        //访问和设置的是vm,实际影响的是obj
        const vm = new Proxy(obj, {
            get(obj, key) {
                console.log("get");
                return obj[key];
            },
            set(obj, key, value) {
                console.log("set");
                obj[key] = value;
                box.innerHTML = value;
            }
        })
    </script>
</body>

</html>